<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Client-side prediction</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Client-side_prediction"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Client-side_prediction rootpage-Client-side_prediction skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Client-side prediction</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><p><b>Client-side prediction</b> is a <a href="Computer_network_programming" title="Computer network programming">network programming</a> technique used in <a href="Video_game" title="Video game">video games</a> intended to conceal negative effects of high <a href="Latency_(engineering)" title="Latency (engineering)">latency</a> connections. The technique attempts to make the player's input feel more instantaneous while governing the player's actions on a remote <a href="Server_(computing)" title="Server (computing)">server</a>.
</p><p>The process of client-side prediction refers to having the <a href="Client_(computing)" title="Client (computing)">client</a> locally react to user input before the server has acknowledged the input and updated the game state.<sup id="cite_ref-Bernier01_1-0" class="reference"><a href="#cite_note-Bernier01-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> So, instead of the client only sending control input to the server and waiting for an updated game state in return, the client also, in parallel with this, predicts the game state locally, and gives the user feedback without awaiting an updated game state from the server.
</p><p>Client-side prediction reduces latency problems, since there no longer will be a delay between input and client-side visual feedback due to network ping times. However, it also introduces a desynchronization of the client and server game states, which needs to be handled to keep the game playable.<sup id="cite_ref-Bernier01_1-1" class="reference"><a href="#cite_note-Bernier01-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> Usually, the desync is corrected when the client receives the updated game state, but as instantaneous correction would lead to "snapping", there are usually some "smoothing" algorithms involved. For example, one common smoothing algorithm would be to check each visible object's client-side location to see if it is within some error epsilon of its <a href="Server-side" class="mw-redirect" title="Server-side">server-side</a> location. If not, the client-side's information is updated to the server-side directly (snapped because of too much desynchronization). However, if the client-side location is not too far, a new position between the client-side and server-side is interpolated; this position is set to be within some small step delta from the client-side location, which is generally judged to be "small enough" to be unintrusive to the user.
</p><p>Another solution to the desynchronization issue, commonly used in conjunction with client-side prediction, is called <i>server reconciliation</i>.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> The client includes a sequence number in every input sent to the server, and keeps a local copy. When the server sends an authoritative update to a client, it includes the sequence number of the last processed input for that client. The client accepts the new state, and reapplies the inputs not yet processed by the server, completely eliminating visible desynchronization issues in most cases.
</p><p>The earliest known <a href="First-person_shooter" title="First-person shooter">first-person shooter</a> to use client-side prediction is <a href="Duke_Nukem_3D" title="Duke Nukem 3D">Duke Nukem 3D</a>, which had it built-in since the January 29, 1996 <a href="Shareware" title="Shareware">shareware</a> release.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> The technique was also a prominent feature of <i><a href="QuakeWorld" class="mw-redirect" title="QuakeWorld">QuakeWorld</a></i>, the popular add-on to <i><a href="Quake_(video_game)" title="Quake (video game)">Quake</a></i>. While network play was included in the original <i>Quake</i> game, it was optimized mainly for <a href="LAN" class="mw-redirect" title="LAN">LAN</a> play. Having had high-speed home connections (a rarity at the time), <i>Quake'</i>s designers overlooked their assumptions of high bandwidth and low ping times that made playing online frustrating for <a href="Dial-up" class="mw-redirect" title="Dial-up">dial-up</a> users.<sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup> After a series of experiments in a long private beta, <a href="Id_Software" title="Id Software">id Software</a> released <i>QuakeWorld</i> with a new predictive model that proved popular with both high and low latency players.
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Lag_(online_gaming)" class="mw-redirect" title="Lag (online gaming)">Lag (online gaming)</a></li>
<li><a href="Rollback_netcode" class="mw-redirect" title="Rollback netcode">Rollback netcode</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */
.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}
/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-Bernier01-1"><span class="mw-cite-backlink">^ <a href="#cite_ref-Bernier01_1-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-Bernier01_1-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */
.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}
/* end https://en.wikipedia.org/ */
</style><cite id="CITEREFBernier2001" class="citation web cs1">Bernier, Yahn W. (2001). <a rel="nofollow" class="external text" href="http://web.cs.wpi.edu/~claypool/courses/4513-B03/papers/games/bernier.pdf">"Latency Compensating Methods in Client/Server In-game Protocol Design and Optimization"</a> <span class="cs1-format">(PDF)</span><span class="reference-accessdate">. Retrieved <span class="nowrap">2008-12-19</span></span>.</cite></span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text">Gabriel Gambetta, <a rel="nofollow" class="external text" href="http://www.gabrielgambetta.com/client-side-prediction-server-reconciliation.html">Client-Side Prediction and Server Reconciliation</a></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><cite id="CITEREFDransfield2018" class="citation journal cs1">Dransfield, Ian (2018-07-14). <a rel="nofollow" class="external text" href="https://www.pressreader.com/uk/retro-gamer/20180614/281565176453517">"The Engine Room: Build"</a>. <i><a href="Retro_Gamer" title="Retro Gamer">Retro Gamer</a></i> (182). United Kingdom: <a href="Future_plc" title="Future plc">Future plc</a>: <span class="nowrap">62–</span>67. <a href="ISSN_(identifier)" class="mw-redirect" title="ISSN (identifier)">ISSN</a> <a rel="nofollow" class="external text" href="https://search.worldcat.org/issn/1742-3155">1742-3155</a><span class="reference-accessdate">. Retrieved <span class="nowrap">2018-11-24</span></span>.</cite></span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><cite class="citation cs2"><a rel="nofollow" class="external text" href="https://github.com/videogamepreservation/dukenukem3d"><i>Duke Nukem 3D (v1.5 CD Version) Source Code Release - April 1, 2003</i></a>, See domovethings(), fakedomovethings(), and fakedomovethingscorrect(), Video Game Preservation, 2019-05-15<span class="reference-accessdate">, retrieved <span class="nowrap">2019-05-15</span></span></cite><span class="cs1-maint citation-comment"><code class="cs1-code">{{citation}}</code>: CS1 maint: others (link)</span></span>
</li>
<li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text">John Carmack, <a rel="nofollow" class="external text" href="http://fabiensanglard.net/quakeSource/johnc-log.aug.htm">QuakeWorld .plan</a></span>
</li>
</ol></div></div></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-07-15" href="https://en.wikipedia.org/wiki/?title=Client-side_prediction&oldid=1300697617">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
</body></html>